from boot import QLabel, Qt, Union, QWidget, IMG_ROOT_DIR, QPixmap


__all__ = ["QQ9ContentLogo"]


class QQ9ContentLogo(QLabel):
    def __init__(self, parent: Union[QWidget, None]=None, icon_path: str=IMG_ROOT_DIR + "/pay.png"):
        super().__init__(parent=parent)

        # 加载图片并缩放到100x100像素
        pixmap = QPixmap(icon_path).scaled(100, 100, Qt.KeepAspectRatio, Qt.SmoothTransformation)

        # 设置图片居中显示
        self.setPixmap(pixmap)
        self.setAlignment(Qt.AlignCenter)

        # 设置QLabel的大小为图片的大小
        self.setFixedSize(pixmap.size())